package com.example.common.po;

import com.example.common.utils.UUIDGenerator;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
public class Po implements Serializable {

    private String id;

    private Date createTime;

    private Date updateTime;

    public String getId() {
        if (id == null) {
            id = UUIDGenerator.getRandomId();
        }
        return id;
    }

    public void recalculation() {
        if (createTime == null) {
            createTime = new Date();
        }
        updateTime = new Date();
    }

}
